package com.wqr.mobile.android.ui;

import java.util.HashMap;

import android.app.TabActivity;
import android.content.Intent;
import android.os.Bundle;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.TabHost;
import android.widget.TextView;

/**
 * activity templete
 * 
 * @author wenqiurong
 * 
 */
public abstract class AbsTabActivity extends TabActivity {
	public TabHost mTabhost;
	public static String TAG;

	// public String mSid;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		TAG = this.getClass().getSimpleName();
		// mSid = SharedPrefsUtil.getValue(this, Conf.KEY_SID, "");
		setUp();

		// if (savedInstanceState != null) {
		// mTabhost.setCurrentTabByTag(savedInstanceState.getString(TAG));
		// }
	}

	// // 保存状态
	// @Override
	// protected void onSaveInstanceState(Bundle outState) {
	// super.onSaveInstanceState(outState);
	// outState.putString(TAG, mTabhost.getCurrentTabTag());
	// }

	@Override
	protected void onDestroy() {
		super.onDestroy();
		Intent exitIntent = new Intent();// 创建Intent对象
		exitIntent.setAction("app.download.cmd.receiver");
		exitIntent.putExtra("cmd", 7); // 退出下载线程指令
		sendBroadcast(exitIntent);// 发送广播
		destory();
		Log.i(TAG, "templete onDestroy");
	}

	// @Override
	// public boolean onKeyDown(int keyCode, KeyEvent event) {
	// if (keyCode == KeyEvent.KEYCODE_BACK && event.getRepeatCount() == 0) {
	// finish();
	// return false;
	// } else {
	// return super.onKeyDown(keyCode, event);
	// }
	// }

	@Override
	public void onLowMemory() {
		System.gc();
		super.onLowMemory();
	}

	/**
	 * activity Initializa
	 */
	protected abstract void setUp();

	/**
	 * clear object
	 */
	protected abstract void destory();

}
